<template>
  <div class="container-wrap">
	<uni-nav-bar fixed shadow :border="false" :title="titleName"
		left-icon="left" @clickLeft="onClickLeft"
		></uni-nav-bar>
    <div class="list-wrap common-wrap" >
      <van-list v-model="listLoading" :finished="listFinished" finished-text="没有更多了" @load="loadMore">
        <div class="list-container" v-if="list.length > 0">
          <div class="list-item" v-for="(item, index) in list" :key="index" @click="goDetail(item)">
            <div class="list-item-title fs-16 fc-333 fw-b">{{item.title}}</div>
            <div class="list-item-time fs-12 fc-999">{{item.createDate}}</div>
          </div>
        </div>
      </van-list>
    </div>
  </div>
</template>

<script>
import {getMsgContent } from '@/assets/js/util'
import CustomSelect  from "@/components/common/CustomSelect.vue"
import vanList  from "@/components/vant/van-list/van-list.vue"
import vanActionSheet  from "@/components/vant/van-action-sheet/van-action-sheet.vue"
import mockData from "@/mock/index/announcement.json"
export default {
	components:{
		CustomSelect,
		vanList,
		vanActionSheet
	},
  data() {
    return {
      titleName: '公告',
      list: [], // 课程列表
      listLoading: false,
      listFinished: false,
      siteMenuSourse: '',
      showPopover: false,
      actions: [{ text: '集团', value: 'S' }, { text: '单位', value: 'D' }],
    }
  },
  mounted() {
	this.getList()
  },
  methods: {
    onClickLeft() {
      uni.navigateBack({ delta: 1 })
    },
    onSelect(action) {
      this.getList(true)
    },
    getMsgContent(content) {
      return getMsgContent(content)
    },
    getList(loadNew = false) {
		 this.list =mockData.data.list;
		 this.listFinished = true
    },
    loadMore() {
      if (!this.listFinished) this.getList()
    },
    goDetail(item) {
      this.$uniPush({ name: 'notice-id', params: { id: item.id } })
    }
  }
}
</script>

<style lang="scss" scoped>
.container-wrap{
  min-height: 100vh;
  background: #F6F6F6;
  .list-wrap{
	  height: calc(100vh - var(--status-bar-height) - 44px);
    padding-top: 10px;
    .list-container {
      padding: 15px 20px;
      border-radius: 17px;
      background: #fff;

    }
    .list-item{
      margin-bottom: 15px;
      border-bottom: 1px solid #EEEEEE;
      &:last-child {
        margin-bottom: 0;
        border: 0;
      }
      .list-item-title{
        line-height: 20px;
        margin: 0 0 2px;
      }
      .list-item-time{
        line-height: 17px;
        margin: 5px 0 15px;
      }
    }
  }
}
</style>
